package com.sangfor.ssl.service.data;

import com.sangfor.ssl.service.setting.SettingManager;
import com.sangfor.ssl.service.setting.SystemConfiguration;
import com.sangfor.ssl.service.utils.IGeneral;
import com.sangfor.ssl.service.utils.network.HttpConnect;
import java.util.HashMap;
import java.util.Map;

/* loaded from: classes2.dex */
public class DataManager {
    public static final String CHANGE_NOTE_URL = "/por/changepwd.csp?cknote=1&type=cs";
    public static final String CHANGE_PASSWORD_URL = "/por/changepwd.csp?cknote=0&type=cs";
    public static final String CHANGE_TEL_URL = "/por/changetelnum.csp?type=cs";
    public static final String CONF_URL = "/por/conf.csp?type=cs";
    public static final String RC_URL = "/por/rclist.csp?type=cs";
    public static final String SSO_CHANGE_URL = "/por/chgSsoInfo.csp?type=cs";
    public static final String SSO_INFO_URL = "/por/perssoinfo.csp?type=cs";
    private static DataManager instance = null;
    public static String localRclist = "NOT_SAVE_RCLIST";

    public static synchronized DataManager getInstance() {
        DataManager dataManager;
        synchronized (DataManager.class) {
            if (instance == null) {
                instance = new DataManager();
            }
            dataManager = instance;
        }
        return dataManager;
    }

    private String getVpnAddress() {
        return (String) SettingManager.getInstance().getGlobalValue(SettingManager.GLOBAL_HOST_KEY);
    }

    public Object getConf() {
        return request(CONF_URL, new HashMap());
    }

    public Object getRclist() {
        String str = (String) request(RC_URL, new HashMap());
        if (!localRclist.equals("NOT_SAVE_RCLIST")) {
            localRclist = str;
        }
        return str;
    }

    public String getLocalRclist(boolean z) {
        if (z) {
            localRclist = "SAVE_RCLIST";
        }
        return localRclist;
    }

    public Object request(String str, Map<String, String> map) {
        return request(str, map, "POST");
    }

    public Object request(String str, Map<String, String> map, String str2) {
        String str3 = "";
        if (!str.startsWith(IGeneral.PROTO_HTTPS_HEAD)) {
            String vpnAddress = getVpnAddress();
            if (vpnAddress == null) {
                return "";
            }
            str3 = vpnAddress.lastIndexOf("/") == vpnAddress.length() + (-1) ? vpnAddress.substring(0, vpnAddress.length() - 1) : vpnAddress;
        }
        try {
            return new HttpConnect().requestStringWithURL(str3 + str, map, str2.toUpperCase(), SystemConfiguration.getInstance().getAuthCipher());
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
